//
//  EcgParamObj.h
//  sr01sdkProject
//
//  Created by  on 2024/3/5.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/* ECG */

typedef NS_ENUM(uint8_t, DISP_SRC) {
    DISP_SRC_0 = 0, // 原始数据
    DISP_SRC_1 = 1,// 1:算法库数据
    DISP_SRC_2 = 2, // 2:原始数据，并且调用 B-Secur 算法
};

// 内部时钟源
typedef NS_ENUM(uint8_t, CA_ECG_CLOCK_SRC) {
        CA_ECG_CLOCK_SRC_32768 = 1, // default
        CA_ECG_CLOCK_SRC_32000 = 2,
    
};

typedef NS_ENUM(uint16_t, CA_ECG_SR_SPRATE_CLK32768) {
        CA_ECG_SR_SPR_IDX_2048 = 1,
        CA_ECG_SR_SPR_IDX_1024,
        CA_ECG_SR_SPR_IDX_512, // default
        CA_ECG_SR_SPR_IDX_256,
        CA_ECG_SR_SPR_IDX_128,
        CA_ECG_SR_SPR_IDX_64,
        CA_ECG_SR_SPR_IDX_32768_MAX,
};

typedef NS_ENUM(uint16_t, CA_ECG_SR_SPRATE_CLK32000) {
    
        CA_ECG_SR_SPR_IDX_2000 = 1,
        CA_ECG_SR_SPR_IDX_1000,
        CA_ECG_SR_SPR_IDX_500, // default
        CA_ECG_SR_SPR_IDX_250,
        CA_ECG_SR_SPR_IDX_125,
        CA_ECG_SR_SPR_IDX_62_5,
        CA_ECG_SR_SPR_IDX_32000_MAX,
};


typedef NS_ENUM(uint8_t, CA_ECG_PGA_GAIN) {
        CA_ECG_PGA_GAIN_0 = 0X00,
        CA_ECG_PGA_GAIN_1 = 0X01,
        CA_ECG_PGA_GAIN_2 = 0X02, // default
        CA_ECG_PGA_GAIN_3 = 0X03,
        CA_ECG_PGA_GAIN_7 = 0X07,

};

// 信号源
typedef NS_ENUM(NSUInteger, CA_PPG_LEDX) {
        CA_PPG_LED1_GREEN  = 0,
        CA_PPG_LED2_IR     = 1, // default
        CA_PPG_LED3_RED    = 2,
        CA_PPG_LED4_GREEN  = 3,
        CA_PPG_LED5_RED    = 4,
        CA_PPG_LED6_IR     = 5,
};

// 采样电流
typedef NS_ENUM(NSUInteger, CAPPG_CURRENT) {
    CA_PPG_CURRENT_10 = 0X10, // default

};

/* ECG */


@interface CAEcgParamObj : NSObject
{
    uint16_t _sampleRate;
    uint8_t _clockSource;
    uint8_t _ecgPgaGain;
    
    uint8_t _ppdLedx;  // 灯
    uint8_t _ppdCurrent; // 测量电流
    
    CGFloat _deviceYgain; //设备的电压增益
    
}

@property(assign, nonatomic)BOOL isRowWave; // 是否原始波形 YES=不过戒指算法的波形
@property(assign, nonatomic) DISP_SRC disp_src;

+(CAEcgParamObj *)defaultLocalAlgorithemParam;
// 使用网络计算ecg
+(CAEcgParamObj *)defaultNetAlgorithemParam;

- (instancetype)initWithClock32768:(CA_ECG_SR_SPRATE_CLK32768)sampleRate;

- (instancetype)initWithClock32000:(CA_ECG_SR_SPRATE_CLK32000)sampleRate;

-(CA_ECG_SR_SPRATE_CLK32768)sampleRateWhenSrc32768;
-(CA_ECG_SR_SPRATE_CLK32000)sampleRateWhenSrc32000;

-(CA_ECG_CLOCK_SRC)clockSource;

-(CA_ECG_PGA_GAIN)ecgPgaGainIdx;


-(uint8_t)ppdLedx;  // 灯

-(uint8_t)ppdCurrent; // 测量电流

//-(CGFloat)transWaveToVol:(CGFloat)wave;
//-(CGFloat)transWaveToVol:(CGFloat)wave IsRow:(BOOL)isRow;
-(CGFloat)transWaveToVol:(CGFloat)wave ;


@end

NS_ASSUME_NONNULL_END
